#include "led.h"

void Led_Disp(unsigned char adder,enable)
{
	static unsigned char temp = 0x00;
	static unsigned char temp_old = 0xff;
	if(enable)
		temp |= 0x01 << adder;
	else
		temp &= ~ (0x01 << adder);
	if(temp != temp_old)
	{
		P0 = ~temp;
		P2 = P2 & 0X1F | 0X80;
		P2 &=0x1f;
		temp_old = temp;
	}

}


void beep(unsigned char faly)
{
	static unsigned char temp = 0x00;
	static unsigned char temp_old = 0xff;
	if(faly)
		temp |= 0x40;
	else
		temp &= ~0x40;
	if(temp != temp_old)
	{
		P0 = temp;
		P2 = P2 & 0X1F | 0Xa0;
		P2 &=0x1f;
		temp_old = temp;
	}

}




void Relay(unsigned char faly)
{
	static unsigned char temp = 0x00;
	static unsigned char temp_old = 0xff;
	if(faly)
		temp |= 0x10;
	else
		temp &= ~0x10;
	if(temp != temp_old)
	{
		P0 = temp;
		P2 = P2 & 0X1F | 0Xa0;   
		P2 &=0x1f;
		temp_old = temp;
	}

}
